<template>
  <h2>父级组件</h2>
  <h3>msg:{{ msg }}</h3>
  <button @click="msg += '==='">更新数据</button>
  <hr>
  <MyChild :msg="msg" msg2="我是msg2" @xxx="xxxx"/>
</template>

<script lang="ts">

import { defineComponent, ref } from 'vue';
// 引入子级组件
import MyChild from './components/MyChild.vue'
export default defineComponent({

  name: 'App',
  //注册组件
  components: {
    MyChild
  },
  setup() {
    //顶一个Ref类型的数据
    const msg = ref('wht wht s')
    function xxxx(txt: string) {
      msg.value += txt
    }
    return {
      msg,
      xxxx
    }
  }
});
</script>
<style>
</style>
